import Vue from "vue";
import VueRouter from "vue-router";
// import Main from 'fakumaPath/common/main'
import fakumaHome from "fakumaPath/index";
import foundationHome from "foundationPath/index";
import pcMain from "fakumaPath/pc/common/index";
import pcInfo from "fakumaPath/pc/common/infoindex.vue";
import wapMain from "fakumaPath/wap/common/index";

Vue.use(VueRouter);
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};
const routes = [
  // 子路由
  {
    path: "/",
    redirect: "/foundation"
  },
  {
    path: "/foundation",
    component: foundationHome,
    children: [
      {
        path: "/foundation/pc",
        redirect: "/foundation/pc/index",
        component: pcMain,
        children: [
          {
            path: "index",
            component: () => import("foundationPath/pc/index/index.vue")
          },
          {
            path: "home",
            meta: {
              active: "home",
              title: "Covestro Digital Showroom"
            },
            component: () => import("foundationPath/pc/home/index.vue")
          },
          {
            path: "search",
            name: "产品搜索",
            component: () => import("foundationPath/pc/search/index.vue")
          },
          {
            path: "detail/:id",
            name: "产品详情",
            component: () => import("foundationPath/pc/detail/index.vue")
          },
          {
            path: "scene",
            name: "场景选择",
            component: () => import("foundationPath/pc/home/index.vue")
          },
          {
            path: "/foundation/pc/video",
            name: "pc视频列表",
            meta: {
              title: "Covestro Digital Showroom",
              keepAlive: true
            },
            component: () => import("foundationPath/pc/video/index.vue")
          },
          {
            path: "/foundation/pc/videodetail",
            name: "pc视频详情",
            component: () => import("foundationPath/pc/video/detail.vue")
          },
          {
            path: "info",
            name: "个人信息",
            component: pcInfo,
            children: [
              // 子路由
              {
                path: "index",
                name: "个人信息",
                meta: {
                  active: "info"
                },
                component: () => import("fakumaPath/pc/info/index.vue")
              },
              {
                path: "collection",
                name: "我的收藏",
                meta: {
                  active: "collection"
                },
                component: () => import("fakumaPath/pc/info/collection.vue")
              },
              {
                path: "password",
                name: "账号与密码",
                meta: {
                  active: "password"
                },
                component: () => import("fakumaPath/pc/info/password.vue")
              }
            ]
          }
        ]
      },
      {
        path: "/foundation/wap",
        redirect: "/foundation/wap/index",
        component: wapMain,
        children: [
          {
            path: "index",
            meta: {
              title: "Covestro Digital Showroom"
            },
            component: () => import("foundationPath/wap/index/index.vue")
          },
          {
            path: "home",
            component: () => import("foundationPath/wap/home/index.vue")
          },
          {
            path: "search",
            component: () => import("foundationPath/wap/search/index.vue")
          },
          {
            path: "list",
            name: "产品列表",
            component: () => import("foundationPath/wap/list/index.vue")
          },
          {
            path: "detail/:id",
            name: "产品详情",
            component: () => import("foundationPath/wap/detail/index.vue")
          },
          {
            path: "aboutUsList",
            component: () => import("foundationPath/common/aboutUsInfo.vue")
          },
          {
            path: "login",
            component: () => import("fakumaPath/wap/loginWap/login.vue")
          },
          {
            path: "register",
            component: () => import("fakumaPath/wap/loginWap/register.vue")
          },
          {
            path: "infoindex",
            component: () => import("fakumaPath/wap/common/infoindex.vue")
          },
          {
            path: "info",
            component: () => import("fakumaPath/wap/info/index.vue")
          },
          {
            path: "collection",
            component: () => import("fakumaPath/wap/info/collection.vue")
          },
          {
            path: "password",
            component: () => import("fakumaPath/wap/info/password.vue")
          },
          {
            path: "aboutus",
            name: "关于我们",
            component: () => import("fakumaPath/wap/info/aboutus.vue")
          },
          {
            path: "/foundation/wap/video",
            name: "wap视频列表",
            meta: {
              title: "Covestro Digital Showroom"
            },
            component: () => import("foundationPath/wap/video/index.vue")
          },
          {
            path: "/foundation/wap/videodetail",
            name: "wap视频详情",
            component: () => import("foundationPath/wap/video/detail.vue")
          },
          {
            path: "forget",
            name: "忘记密码",
            component: () => import("fakumaPath/wap/loginWap/forget.vue")
          }
        ]
      },
      {
        path: "/foundation/wap/language",
        name: "语言选择",
        component: () => import("foundationPath/wap/common/language.vue")
      },
      {
        path: "/foundation/common/productCn",
        name: "productIn",
        component: () =>
          import("foundationPath/common/productInnovationsCn.vue")
      },
      {
        path: "/foundation/common/productEn",
        name: "productIn",
        component: () =>
          import("foundationPath/common/productInnovationsEn.vue")
      },
      {
        path: "/foundation/common/receptionCn",
        name: "reception",
        component: () => import("foundationPath/common/receptionCenterCn.vue")
      },
      {
        path: "/foundation/common/receptionEn",
        name: "receptionEn",
        component: () => import("foundationPath/common/receptionCenterEn.vue")
      }
    ]
  },
  {
    path: "/fakuma",
    component: fakumaHome,
    children: [
      {
        path: "/fakuma/pc",
        redirect: "/fakuma/pc/home",
        component: pcMain,
        children: [
          // 子路由
          {
            path: "home",
            name: "PC-首页",
            meta: {
              active: "home",
              title: "Fakuma Trade Floor"
            },
            component: () => import("fakumaPath/pc/home/index.vue")
          },
          {
            path: "search",
            name: "PC-搜索",
            meta: {
              active: "search"
            },
            component: () => import("fakumaPath/pc/search/index.vue")
          },
          {
            path: "schedule",
            name: "PC-日程",
            meta: {
              active: "schedule"
            },
            component: () => import("fakumaPath/pc/schedule/index.vue")
          },
          {
            path: "customer",
            name: "PC-用户中心",
            meta: {
              active: "customer"
            },
            component: () => import("fakumaPath/pc/customer/index.vue")
          },
          {
            path: "detail/:anchorId",
            name: "PC-行业详情",
            component: () => import("fakumaPath/pc/detail/index.vue")
          },
          {
            path: "industry/list/:industryId",
            name: "PC-行业列表",
            component: () => import("fakumaPath/pc/detail/list.vue")
          },
          {
            path: "info",
            name: "个人信息",
            component: pcInfo,
            children: [
              // 子路由
              {
                path: "index",
                name: "个人信息",
                meta: {
                  active: "info"
                },
                component: () => import("fakumaPath/pc/info/index.vue")
              },
              {
                path: "collection",
                name: "我的收藏",
                meta: {
                  active: "collection"
                },
                component: () => import("fakumaPath/pc/info/collection.vue")
              },
              {
                path: "password",
                name: "账号与密码",
                meta: {
                  active: "password"
                },
                component: () => import("fakumaPath/pc/info/password.vue")
              }
            ]
          },

          {
            path: "video",
            name: "PC-视频",
            meta: {
              active: "video"
            },
            component: () => import("fakumaPath/pc/video/index.vue")
          }
        ]
      },
      {
        path: "/fakuma/wap",
        redirect: "/fakuma/wap/home",
        component: wapMain,
        children: [
          // 子路由
          {
            path: "home",
            name: "wap-首页",

            meta: {
              title: "Fakuma Trade Floor"
            },
            component: () => import("fakumaPath/wap/home/index.vue")
          },
          {
            path: "schedule",
            name: "wap-日程",
            component: () => import("fakumaPath/wap/schedule/index.vue")
          },
          {
            path: "customer",
            name: "wap-专家",
            component: () => import("fakumaPath/wap/customer/index.vue")
          },
          {
            path: "detail/:anchorId",
            name: "wap-行业详情",
            component: () => import("fakumaPath/wap/detail/index.vue")
          },
          {
            path: "industry/list/:industryId",
            name: "wap-行业列表",
            component: () => import("fakumaPath/wap/detail/list.vue")
          },
          {
            path: "infoindex",
            name: "个人中心",
            component: () => import("fakumaPath/wap/common/infoindex.vue")
          },
          {
            path: "info",
            name: "个人中心",
            component: () => import("fakumaPath/wap/info/index.vue")
          },
          {
            path: "collection",
            name: "我的收藏",
            component: () => import("fakumaPath/wap/info/collection.vue")
          },
          {
            path: "password",
            name: "账号与密码",
            component: () => import("fakumaPath/wap/info/password.vue")
          },
          {
            path: "login",
            name: "登录",
            component: () => import("fakumaPath/wap/loginWap/login.vue")
          },
          {
            path: "register",
            name: "注册",
            component: () => import("fakumaPath/wap/loginWap/register.vue")
          },
          {
            path: "aboutus",
            name: "关于我们",
            component: () => import("fakumaPath/wap/info/aboutus.vue")
          },
          {
            path: "forget",
            name: "忘记密码",
            component: () => import("fakumaPath/wap/loginWap/forget.vue")
          }
        ]
      }
    ]
  },
  {
    path: "/foundation/economyCn",
    name: "economy",
    component: () => import("foundationPath/common/economyCn.vue")
  },
  {
    path: "/foundation/economyEn",
    name: "economy",
    component: () => import("foundationPath/common/economyEn.vue")
  }
];

const router = new VueRouter({
  routes
});

export default router;
